/**
 * desc: `检测pdf插件
 * author: Joe
 * date: 10/19/2018
 */

coreModule.factory('TestingPdf',
  [
    '$rootScope',
    function($rootScope) {
      return function () {
        //下面代码都是处理IE浏览器的情况
        if((window.ActiveXObject)||(navigator.userAgent.indexOf('Trident') > -1)) {
          for(x = 2; x < 10; x++) {
            try {
              oAcro = eval('new ActiveXObject(\'PDF.PdfCtrl.' + x + '\');');
              if(oAcro) {
                return true;
              }
            } catch(e) {}
          }
          try {
            oAcro4 = new ActiveXObject('PDF.PdfCtrl.1');
            if(oAcro4)
              return true;
          } catch(e) {}
          try {
            oAcro7 = new ActiveXObject('AcroPDF.PDF.1');
            if(oAcro7)
              return true;
          } catch(e) {
              return false
          }
        }else{
          //chrome和FF、safrai等其他浏览器
          return true;
        }
      }
    }
  ]
);
